/*
 * FIFO type tester
 *
 * Copyright (C) 2008  Bartlomiej Zolnierkiewicz
 */

#include <stdio.h>
#include <errno.h>

#include "fifo.h"

#include "cbr_debug.h"

int main(void)
{
	cbr_Logger *logger = new cbr_Logger("fifo.txt");
	fifo_t *tfifo;

	logger->log("FIFO type tester\n");

	tfifo = fifo_alloc(3);
	if (tfifo == NULL)
		return -ENOMEM;

	fifo_enqueue(tfifo, (void *)1);
	fifo_enqueue(tfifo, (void *)2);
	fifo_enqueue(tfifo, (void *)3);

	fifo_dump(tfifo);

	printf("dequeued %d\n", (int)fifo_dequeue(tfifo));
	fifo_enqueue(tfifo, (void *)4);

	printf("dequeued %d\n", (int)fifo_dequeue(tfifo));
	fifo_enqueue(tfifo, (void *)5);

	fifo_dump(tfifo);

	fifo_free(tfifo);

	return 0;
}
